package cn.edu.ctbu.demo2.service;
import cn.edu.ctbu.demo2.domain.Teacher;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Pageable;
import java.util.List;

@Service
public interface TeacherService {

    List<Teacher>findAll();
    //     只支持分页的查询
//    @param pageable
//    @retur
    public Page<Teacher> findAll(Pageable pageable);
    //     分页、带过滤的查询
//    @param pageable
//    @return
    public Page<Teacher> finfAll(Example<Teacher> student,Pageable pageable);
    //    按id进行查询
//    @porom id 主键 整数
//    @return
    Teacher findById(Integer id);
    //    按name进行查询,like
//    @porom name 主键 整数
//    @return
    List<Teacher> findByName(String name);
    //    按name和password进行查询
    List<Teacher>  findByNameAndPassword(String name,String password);

    Teacher insert(Teacher student);

    Teacher update(Teacher student);

    void delete(Teacher student);

    void delete(Long id);

    void delete(Integer id);

    Teacher getById(Long id);

    List<Teacher> getByName(String name);

    /**
     * 验证用户名和密码，如果通过，返回读取的学生
     *
     * @param username
     * @param password
     * @return
     */
    public Teacher validateUserAndPassword(String username, String password) throws Exception;

}
